@inject NavigationManager NavigationManager

<section class="col-12 p-0 mx-0 my-3 col-xxl-6 mx-xxl-0 px-xxl-5">
        <img src="@Image" class="img-fluid px-md-5 px-xxl-0" alt="Vehicle">
        <p class="text-muted small mt-3 text-end px-md-5 px-xxl-0">Photo by @Copyright from Pexels</p>
</section>

<section class="col-12 p-0 mx-0 my-3 col-xxl-6 mx-xxl-0 px-xxl-5">
        <div class="card col-md-6 offset-md-3">
            <div class="card-body">
                <h6 class="fw-bold">@Name</h6>
                <p class="mb-1">This is some text within a card body.</p>
                <p class="bg-success text-white mb-3 py-1 ps-5 rounded-3 small">Unlimited Free Miles Included</p>
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                         class="bi bi-people-fill text-success" viewBox="0 0 16 16">
                        <path d="M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1H7zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
                        <path fill-rule="evenodd"
                              d="M5.216 14A2.238 2.238 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.325 6.325 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1h4.216z"/>
                        <path d="M4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z"/>
                    </svg>
                    <span class="ms-3">@People People</span>
                </div>
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                         class="bi bi-geo-fill text-success" viewBox="0 0 16 16">
                        <path fill-rule="evenodd"
                              d="M4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z"/>
                    </svg>
                    <span class="ms-3">@Transmission transmission</span>
                </div>
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                         class="bi bi-hurricane text-success" viewBox="0 0 16 16">
                        <path d="M6.999 2.6A5.5 5.5 0 0 1 15 7.5a.5.5 0 0 0 1 0 6.5 6.5 0 1 0-13 0 5 5 0 0 0 6.001 4.9A5.5 5.5 0 0 1 1 7.5a.5.5 0 0 0-1 0 6.5 6.5 0 1 0 13 0 5 5 0 0 0-6.001-4.9zM10 7.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
                    </svg>
                    <span class="ms-3">@AirConditioning</span>
                </div>
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                         class="bi bi-wallet-fill text-success" viewBox="0 0 16 16">
                        <path d="M1.5 2A1.5 1.5 0 0 0 0 3.5v2h6a.5.5 0 0 1 .5.5c0 .253.08.644.306.958.207.288.557.542 1.194.542.637 0 .987-.254 1.194-.542.226-.314.306-.705.306-.958a.5.5 0 0 1 .5-.5h6v-2A1.5 1.5 0 0 0 14.5 2h-13z"/>
                        <path d="M16 6.5h-5.551a2.678 2.678 0 0 1-.443 1.042C9.613 8.088 8.963 8.5 8 8.5c-.963 0-1.613-.412-2.006-.958A2.679 2.679 0 0 1 5.551 6.5H0v6A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-6z"/>
                    </svg>
                    <span class="ms-3">@Bags Bags</span>
                </div>
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                         class="bi bi-phone-fill text-success" viewBox="0 0 16 16">
                        <path d="M3 2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V2zm6 11a1 1 0 1 0-2 0 1 1 0 0 0 2 0z"/>
                    </svg>
                    <span class="ms-3">@Doors Doors</span>
                </div>

                <p class="fw-bold small mt-3 pt-3 mb-0 border-top">Pick-up: Sun, Apr 11 | Drop-off: Sun, Apr 18</p>
            </div>
        </div>

        <div class="card mt-4 col-md-6 offset-md-3">
            <div class="card-body">
                <h6 class="fw-bold">Summary</h6>
                <p class="mb-1 small">Sun, Apr 11 - 12:00 PM</p>
                <p class="mb-1 small">Sun, Apr 18 - 12:00 PM</p>

                <h6 class="fw-bold border-top mt-3 pt-3">Charges</h6>
                <p class="mb-1 small">Economy <span class="float-end">$113.94</span></p>
                <p class="mb-1 small">Taxes and fees <span class="float-end">--</span></p>

                <h6 class="fw-bold border-top mt-3 pt-3 mb-0">Total <span class="float-end">$113.94</span></h6>
            </div>
        </div>

        <div class="mt-4 col-md-6 offset-md-3 text-center px-4">
            <button class="col-12 btn btn-primary" @onclick="RentalCar">Rental</button>
        </div>
    </section>

@code {

    [Parameter]
    public int Bags { get; set; }

    [Parameter]
    public int Doors { get; set; }

    [Parameter]
    public int People { get; set; }

    [Parameter]
    public double Price { get; set; }

    [Parameter]
    public string Name { get; set; }

    [Parameter]
    public string Image { get; set; }
    
    [Parameter]
    public string License { get; set; }
    
    [Parameter]
    public string Copyright { get; set; }
    
    [Parameter]
    public string Transmission { get; set; }
    
    [Parameter]
    public string AirConditioning { get; set; }
    
    [CascadingParameter]
    private Task<AuthenticationState> AuthenticationStateTask { get; set; }
    
    private async Task RentalCar()
    {
        var authState = await AuthenticationStateTask;
        var user = authState.User;

        if (user.Identity.IsAuthenticated)
        {
            NavigationManager.NavigateTo("/Rent/" + License);
        }
        else
        {
            NavigationManager.NavigateTo("/SignIn");
        }
    }
    
}